package com.wingsfrog.travel.modules.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by rankin on 16/3/30.
 */
@Entity
@Table(name = "t_team_task", schema = "", catalog = "travel")
public class TeamTask {
    private int id;
    private int teamId;
    private int taskId;
    private String taskName;
    private String taskDescription;
    private Byte enabled;
    private int taskType;
    private int taskScore;
    private int sequence;
    private String checkpoint;
    private Timestamp acceptedAt;
    private byte finished;
    private Timestamp createdAt;
    private Timestamp updatedAt;
    private String createBy;
    private String updateBy;

    @Id
    @Column(name = "id")
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column
    public int getTeamId() {
        return teamId;
    }

    public void setTeamId(int teamId) {
        this.teamId = teamId;
    }

    @Basic
    @Column(name = "task_id")
    public int getTaskId() {
        return taskId;
    }

    public void setTaskId(int taskId) {
        this.taskId = taskId;
    }

    @Basic
    @Column(name = "task_name")
    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    @Basic
    @Column(name = "task_description")
    public String getTaskDescription() {
        return taskDescription;
    }

    public void setTaskDescription(String taskDescription) {
        this.taskDescription = taskDescription;
    }

    @Basic
    @Column(name = "enabled")
    public Byte getEnabled() {
        return enabled;
    }

    public void setEnabled(Byte enabled) {
        this.enabled = enabled;
    }

    @Basic
    @Column(name = "task_type")
    public int getTaskType() {
        return taskType;
    }

    public void setTaskType(int taskType) {
        this.taskType = taskType;
    }

    @Basic
    @Column(name = "task_score")
    public int getTaskScore() {
        return taskScore;
    }

    public void setTaskScore(int taskScore) {
        this.taskScore = taskScore;
    }

    @Basic
    @Column(name = "sequence")
    public int getSequence() {
        return sequence;
    }

    public void setSequence(int sequence) {
        this.sequence = sequence;
    }

    @Basic
    @Column(name = "checkpoint")
    public String getCheckpoint() {
        return checkpoint;
    }

    public void setCheckpoint(String checkpoint) {
        this.checkpoint = checkpoint;
    }

    @Basic
    @Column(name = "accepted_at")
    public Timestamp getAcceptedAt() {
        return acceptedAt;
    }

    public void setAcceptedAt(Timestamp acceptedAt) {
        this.acceptedAt = acceptedAt;
    }

    @Basic
    @Column(name = "finished")
    public byte getFinished() {
        return finished;
    }

    public void setFinished(byte finished) {
        this.finished = finished;
    }

    @Basic
    @Column(name = "created_at")
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    public Timestamp getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updatedAt = updatedAt;
    }

    @Basic
    @Column(name = "create_by")
    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    @Basic
    @Column(name = "update_by")
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TeamTask teamTask = (TeamTask) o;

        if (id != teamTask.id) return false;
        if (taskId != teamTask.taskId) return false;
        if (taskType != teamTask.taskType) return false;
        if (taskScore != teamTask.taskScore) return false;
        if (sequence != teamTask.sequence) return false;
        if (finished != teamTask.finished) return false;
        if (taskName != null ? !taskName.equals(teamTask.taskName) : teamTask.taskName != null) return false;
        if (taskDescription != null ? !taskDescription.equals(teamTask.taskDescription) : teamTask.taskDescription != null)
            return false;
        if (enabled != null ? !enabled.equals(teamTask.enabled) : teamTask.enabled != null) return false;
        if (checkpoint != null ? !checkpoint.equals(teamTask.checkpoint) : teamTask.checkpoint != null) return false;
        if (acceptedAt != null ? !acceptedAt.equals(teamTask.acceptedAt) : teamTask.acceptedAt != null) return false;
        if (createdAt != null ? !createdAt.equals(teamTask.createdAt) : teamTask.createdAt != null) return false;
        if (updatedAt != null ? !updatedAt.equals(teamTask.updatedAt) : teamTask.updatedAt != null) return false;
        if (createBy != null ? !createBy.equals(teamTask.createBy) : teamTask.createBy != null) return false;
        if (updateBy != null ? !updateBy.equals(teamTask.updateBy) : teamTask.updateBy != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + taskId;
        result = 31 * result + (taskName != null ? taskName.hashCode() : 0);
        result = 31 * result + (taskDescription != null ? taskDescription.hashCode() : 0);
        result = 31 * result + (enabled != null ? enabled.hashCode() : 0);
        result = 31 * result + taskType;
        result = 31 * result + taskScore;
        result = 31 * result + sequence;
        result = 31 * result + (checkpoint != null ? checkpoint.hashCode() : 0);
        result = 31 * result + (acceptedAt != null ? acceptedAt.hashCode() : 0);
        result = 31 * result + (int) finished;
        result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
        result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0);
        result = 31 * result + (createBy != null ? createBy.hashCode() : 0);
        result = 31 * result + (updateBy != null ? updateBy.hashCode() : 0);
        return result;
    }
}
